package com.liuyh.demo.serviceconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    RestTemplate restTemplate;

    @PostMapping("/test")
    public @ResponseBody String test(){
        return "test";
    }

    @PostMapping("/add")
    public @ResponseBody String add(int a,int b){
        return restTemplate.postForEntity("http://test-server/test/add?a=1&b=2",null,String.class).getBody();
    }
}
